// 购物页面相关接口
import type { ResCategoryTop10, ResGoodsList } from '@/types/goods'
import http from '@/utils/http'

export enum API {
  // 获取分类前十
  CATEGORY_TOP10 = '/goods/top10Category',
  // 获取商品列表
  GOODS_LIST = '/goods/goodsList'
}

/**
 * 获取分类前十
 * @returns
 */
export const reqCategoryTop10 = () => {
  return http.get<any, ResCategoryTop10>(API.CATEGORY_TOP10)
}

/**
 * 获取商品列表
 * @param page 页码
 * @param size 条数
 * @returns
 */
export const reqGoodsList = (page = 1, size = 10) => {
  return http.get<any, ResGoodsList>(API.GOODS_LIST, {
    params: {
      page,
      size
    }
  })
}
